﻿<UserControl x:Class="PCSWpfClient.View.PriceSeriesPricesView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
                  xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
        
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    
    <UserControl.Resources>
        <Style TargetType="DataGridCell" x:Key="CentreDataGridCell">
            <Setter Property="HorizontalAlignment" Value="Center" />
        </Style>

    </UserControl.Resources>
    <GroupBox>
        <GroupBox.Header>Prices</GroupBox.Header>
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <DataGrid Grid.Column="0" ItemsSource="{Binding Path=PriceList}"
                              SelectedItem="{Binding CurrentPrice}" AutoGenerateColumns="False" IsReadOnly="true" CanUserAddRows="False">
            <i:Interaction.Triggers>
                <i:EventTrigger EventName="SelectionChanged">
                    <i:InvokeCommandAction Command="{Binding SelectedPriceChangedCommand}"  CommandParameter="{Binding  Path=CurrentPrice}"/>
                </i:EventTrigger>
            </i:Interaction.Triggers>
                <DataGrid.Columns>
                    <DataGridTextColumn Header="Value As Of" MinWidth="70" Binding="{Binding Path=ValueAsOf, StringFormat={}{0:d}}" />
                    <DataGridTextColumn Header="Ror" MinWidth="50" Binding="{Binding Path=Ror, StringFormat=F2}"/>
                    <DataGridTextColumn Header="Nav" MinWidth="50" Binding="{Binding Path=Nav, StringFormat={}{0:n2}}" />
                </DataGrid.Columns>
            </DataGrid>
    </Grid>
    </GroupBox>
</UserControl>
